package cn.demo.um.service.impl;

import java.util.List;
import com.mybatisflex.core.paginate.Page;
import cn.demo.common.core.page.PageQuery;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import cn.demo.um.mapper.UmAttrDataMapper;
import cn.demo.um.domain.UmAttrData;
import cn.demo.um.service.IUmAttrDataService;

/**
 * 用户属性值Service业务层处理
 *
 * @author xtjun
 * @date 2024-06-06
 */
@Service
public class UmAttrDataServiceImpl extends ServiceImpl<UmAttrDataMapper, UmAttrData> implements IUmAttrDataService {
    @Resource
    private UmAttrDataMapper umAttrDataMapper;
    /**
     * 查询用户属性值
     *
     * @param id 用户属性值主键
     * @return 用户属性值
     */
    @Override
    public UmAttrData selectUmAttrDataById(String id) {
        return umAttrDataMapper.selectOneById(id);
    }

    /**
     * 查询用户属性值列表
     *
     * @param umAttrData 用户属性值
     * @return 用户属性值
     */
    @Override
    public Page<UmAttrData> selectUmAttrDataPage(UmAttrData umAttrData, PageQuery pageQuery) {
        return umAttrDataMapper.paginate(pageQuery.build(), QueryWrapper.create(umAttrData,UmAttrData.operators));
    }
    @Override
    public List<UmAttrData> selectUmAttrDataList(UmAttrData umAttrData) {
        return umAttrDataMapper.selectListByQuery(QueryWrapper.create(umAttrData,UmAttrData.operators));
    }

    /**
     * 新增用户属性值
     *
     * @param umAttrData 用户属性值
     * @return 结果
     */
    @Override
    public int insertUmAttrData(UmAttrData umAttrData) {
        return umAttrDataMapper.insert(umAttrData);
    }

    /**
     * 修改用户属性值
     *
     * @param umAttrData 用户属性值
     * @return 结果
     */
    @Override
    public int updateUmAttrData(UmAttrData umAttrData) {
        return umAttrDataMapper.update(umAttrData);
    }

    /**
     * 批量删除用户属性值
     *
     * @param ids 需要删除的用户属性值主键
     * @return 结果
     */
    @Override
    public int deleteUmAttrDataByIds(List<String> ids) {
        return umAttrDataMapper.deleteBatchByIds(ids);
    }

    /**
     * 删除用户属性值信息
     *
     * @param id 用户属性值主键
     * @return 结果
     */
    @Override
    public int deleteUmAttrDataById(String id) {
        return umAttrDataMapper.deleteById(id);
    }
}
